<meta charset="utf-8">
<?php
//连接到数据库  
mysql_connect("localhost","root","1161105403");
   mysql_select_db("neuvideo");
   mysql_query("set names utf8");
//用户id是通过GET方法提交的   
  $tid = $_GET['tid'];    
//如果该视频类型中还有视频 该类型不能删除
$sql0="select * from videos where tid=$tid";
$rs0=mysql_query($sql0);
$num0=mysql_num_rows($rs0);
if($num0==0)
{
$sql="delete from videotype where tid=$tid";
$num=mysql_query($sql);
if($num>0){
        echo "删除成功,2秒后返回";
		header("refresh:2;url='video_type.php'");
}
else{
    echo "删除失败,2秒后返回";
		header("refresh:2;url='video_type.php'");
}
}else{
	   echo "该类型中还有视频，不能删除该类型";
		header("refresh:2;url='video_type.php'");
  
}
  ?>        
